#include <iostream>
using namespace std;


class A
{
public:
	A(int a )
		:_a(a)
	{
		cout << "A(int a = 0)" << endl;
	}
	~A()
	{
		cout << "~A()" << endl;
	}
private:
	int _a;
};


int main()
{
	
	A* pa3 = new A[3]{ A(1),A(2),A(3) };
	delete[] pa3;
	return 0;
}
























//int main()
//{
//	int* p1 = new int;
//	int* p2 = new int(3);
//
//	int* p3 = new int[5];
//	int n = 5;
//	int* p4 = new int[n] {1, 2, 3, 4, 5};
//	
//	delete p1;
//	delete p2;
//	delete[] p3;
//	delete[] p4;
//
//
//	/*a* pa1 = (a*)malloc(sizeof(a) * 5);
//	a* pa2 = new a[5]{1,2,3,4,5};
//	a* pa3 = new a[5]{ a(1),a(1),a(1),a(1),a(1) };
//
//	free(pa1);
//	delete[] pa2;
//	delete[] pa3;
//
//	
//	A* p1 = (A*)malloc(sizeof(A));
//	new(p1)A(1);*/
//
//	return 0;
//
//}

//
//int main()
//{
//	int* p1 = (int*)malloc(sizeof(int) * 4);
//
//	int* p2 = (int*)calloc(4, sizeof(int));
//
//	int* p3 = (int*)realloc(p1, sizeof(int) * 10);
//
//	free(p1);
//	free(p2);
//	free(p3);
//}




class Stack
{
public:
	Stack(int capacity, int top = 0)
		:_capacity(capacity)
		, _top(top)
	{
		_a = new int[capacity];
	}
	~Stack()
	{
		delete[] _a;
	}

private:
	int* _a;
	int _capacity;
	int _top;
};

int main()
{
	Stack* pst = new Stack(4);
	delete pst;
}